package com.xxx.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class AuthController {
	//登录成功后重定向地址
    @RequestMapping("/loginSuccess")
    @ResponseBody
    public Object loginSuccess(){
        //获取登录用户信息
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        System.out.println("登录成功：" + authentication.getName());

        return authentication;
	} 
}